package com.zjsd.sqeybusiness.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zjsd.sqeybusiness.domain.Dzsjdetail;
import com.zjsd.sqeybusiness.service.IDzsjdetailService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 定制商机明细Controller
 *
 * @author Zheng
 * @date 2025-03-11
 */
@RestController
@RequestMapping("/sqeybusiness/dzsjdetail")
public class DzsjdetailController extends BaseController
{
    @Autowired
    private IDzsjdetailService dzsjdetailService;

    /**
     * 查询定制商机明细列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:dzsjdetail:list')")
    @GetMapping("/list")
    public TableDataInfo list(Dzsjdetail dzsjdetail)
    {
        startPage();
        List<Dzsjdetail> list = dzsjdetailService.selectDzsjdetailList(dzsjdetail);
        return getDataTable(list);
    }

    /**
     * 导出定制商机明细列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:dzsjdetail:export')")
    //@Log(title = "定制商机明细", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Dzsjdetail dzsjdetail)
    {
        List<Dzsjdetail> list = dzsjdetailService.selectDzsjdetailList(dzsjdetail);
        ExcelUtil<Dzsjdetail> util = new ExcelUtil<Dzsjdetail>(Dzsjdetail.class);
        return util.exportExcel(list, "dzsjdetail");
    }

    /**
     * 获取定制商机明细详细信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:dzsjdetail:query')")
    @GetMapping(value = "/{detailid}")
    public AjaxResult getInfo(@PathVariable("detailid") Long detailid)
    {
        return AjaxResult.success(dzsjdetailService.selectDzsjdetailById(detailid));
    }

    /**
     * 新增定制商机明细
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:dzsjdetail:add')")
    //@Log(title = "定制商机明细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Dzsjdetail dzsjdetail)
    {
        return toAjax(dzsjdetailService.insertDzsjdetail(dzsjdetail));
    }

    /**
     * 修改定制商机明细
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:dzsjdetail:edit')")
    //@Log(title = "定制商机明细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Dzsjdetail dzsjdetail)
    {
        return toAjax(dzsjdetailService.updateDzsjdetail(dzsjdetail));
    }

    /**
     * 删除定制商机明细
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:dzsjdetail:remove')")
    //@Log(title = "定制商机明细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{detailids}")
    public AjaxResult remove(@PathVariable Long[] detailids)
    {
        return toAjax(dzsjdetailService.deleteDzsjdetailByIds(detailids));
    }
}
